<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" class="tl-dialog" width="1200px" @open="open" @close="close" top="10px" :append-to-body="true" :modal-append-to-body="true">
    <div style="padding-bottom:10px">
      <!-- 查询界面 -->
      <tl-list-search ref="search" :query-param="queryParam" @search="doQuery" :isDisplayDefaultSearch="false">
        <template slot="search">
          <el-form-item label="机会点名称">
            <el-input v-model="queryParam.qry_chancename" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="机会点编号" prop="code">
            <el-input v-model="queryParam.qry_chancecode" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="客户名称" prop="code">
            <el-input v-model="queryParam.qry_clientname" placeholder=""></el-input>
          </el-form-item>
          <el-form-item label="负责人" prop="code">
            <el-input v-model="queryParam.qry_user" placeholder="姓名或工号"></el-input>
          </el-form-item>
        </template>
      </tl-list-search>
      <!-- 列表界面 -->
      <div>
        <!-- 列表选择 -->
        <div class="table-alert-div" ref="selector">
          <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
            <template slot="title">
              已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRows.length }}</a
              >项&nbsp;&nbsp;
              <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
            </template>
          </el-alert>
        </div>
        <!--表格渲染-->
        <el-table class="tl-table" ref="mainTable" :height="tableHeight" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
          <el-table-column type="index" label="序号" width="55px" align="center" fixed="left"></el-table-column>
          <el-table-column prop="dispdeptcommoncode1" label="创建部门" width="100px" align="center" header-align="center"></el-table-column>
          <el-table-column prop="dispdeptname" label="区域" width="100px" align="center" header-align="center"></el-table-column>
          <el-table-column prop="code" label="机会点编号" width="180px" sortable="custom" sort-by="code" align="center" header-align="center"></el-table-column>
          <el-table-column prop="projectname" label="机会点名称" width="150px" align="center" header-align="center"></el-table-column>
					<el-table-column prop="clientname" label="客户名称" width="150px" sortable="custom" sort-by="clientname" align="center" header-align="center"></el-table-column>
          <el-table-column prop="ourprocductfund" label="可参与金额（万元）" width="150px" sortable="custom" sort-by="to_number(ourprocductfund)" align="center" header-align="center"></el-table-column>
          <el-table-column prop="gardenercode" label="负责人工号" width="120px"  align="center"></el-table-column>
          <el-table-column prop="gardenername" label="负责人姓名" width="150px"  align="center" header-align="center"></el-table-column>
          <el-table-column prop="createtime" label="创建时间" width="170px" sortable="custom" sort-by="createtime" align="center" header-align="center" :formatter="dateTimeFormat"></el-table-column>
          <el-table-column prop="dispchancestatus" label="机会点状态" width="100px"  align="center" header-align="center"></el-table-column>
          <el-table-column prop="dispcurrentphase" label="机会点进展阶段" width="150px"  align="center" header-align="center"></el-table-column>
          <!--					<el-table-column prop="dispclientlevel" label="客户级别" width="100px" sortable="custom" sort-by="clientlevel" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="dispclientcatalog" label="客户类型" width="100px" sortable="custom" sort-by="clientcatalog" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="content" label="机会点主要内容" width="150px" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="totalfund" label="总资金预估（万元）" width="150px" sortable="custom" sort-by="totalfund" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="certaintyfund" label="可把控金额（万元）" width="150px" sortable="custom" sort-by="certaintyfund" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="disppurchasemode" label="项目采购实施方式" width="100px" sortable="custom" sort-by="purchasemode" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="forecasttime" label="预测招标采购时间" width="170px" sortable="custom" sort-by="forecasttime" align="center" header-align="center" :formatter="dateTimeFormat"></el-table-column>-->
<!--					<el-table-column prop="bidresultpredicttime" label="投标结果预计公示时间" width="170px" sortable="custom" sort-by="bidresultpredicttime" align="center" header-align="center" :formatter="dateTimeFormat"></el-table-column>-->
<!--					<el-table-column prop="gardenerdeptname" label="项目经理所属部门名称" width="150px" sortable="custom" sort-by="gardenerdeptname" align="center" header-align="center"></el-table-column>-->
<!--					<el-table-column prop="gardenertel" label="项目经理电话" width="150px" sortable="custom" sort-by="gardenertel" align="center" header-align="center"></el-table-column>-->
          <el-table-column label="操作" width="80px" align="center" fixed="right" v-if="isSingleSelect === true">
            <template slot-scope="scope">
              <el-button type="text" icon="el-icon-finished" @click="doSelectData(scope.row[fieldDefaultKey])">选择</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 列表分页 -->
        <el-row class="pagebar" ref="pager">
          <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
        </el-row>
      </div>
    </div>
    <div slot="footer" class="dialog-footer" v-if="isSingleSelect === false">
      <el-button type="text" @click="doCancelEdit">取消</el-button>
      <el-button type="primary" @click="doConfirm">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_ref_list } from '@tapui/mixins/mixin_ref_list'
/** 子组件 */
/** 工具类 */
import { queryDataCode } from '@tapui/api/dataCode'
import { getAction, putAction, postAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  name: 'TlLtcChanceBackboneRef',
  components: {},
  mixins: [mixin_ref_list],
  data() {
    return {
      description: '机会点主干信息表参照页面',
      // 默认Key字段名
      fieldDefaultKey: 'id',
      // 默认显示字段名
      fieldDefaultValue: 'name',
      // url配置
      url: {
        list: '/pm/contract/chanceSelectRefList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'sortcode',
        sord: 'asc'
      }
    }
  },
  methods: { }
}
</script>
